import time

from selenium import webdriver
from selenium.webdriver.common.by import By


def web_locate():
    driver = webdriver.Chrome()
    driver.get("https://vip.ceshiren.com/#/ui_study/locate")
    # id定位
    driver.find_element(By.ID, "located_id").click()
    time.sleep(3)
    # class name 定位
    driver.find_element(By.CLASS_NAME, "el-button.mr-5.locate_class_name.el-button--primary").click()
    time.sleep(3)
    # name 定位
    driver.find_element(By.NAME, "located_name").click()
    time.sleep(3)
    # link test 定位
    driver.find_element(By.LINK_TEXT, "link").click()
    time.sleep(3)
    # partial link test 定位
    driver.find_element(By.PARTIAL_LINK_TEXT, "partial_").click()
    time.sleep(3)
    # tag name 定位
    driver.find_element(By.TAG_NAME, "button").click()
    time.sleep(3)
    # css selector 定位
    driver.find_element(By.CSS_SELECTOR, "#app > div > section > section > main > div > div.box2 > div.grandfather > div.pos.father > button").click()
    time.sleep(3)
    # xpath 定位
    driver.find_element(By.XPATH, '//*[@id="app"]/div/section/section/main/div/div[2]/div[2]/button').click()
    time.sleep(3)

    driver.quit()

if __name__ == '__main__':
    web_locate()



